﻿using blackhouse.JavaScript.JQuery;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;

namespace blackhouse.WebNemo.Web {
    public class NemoJsLibrary : JQueryLibraries {

        #region Methods

        private void IncludeNemoController() {
            this.IncludeJQueryBlockUI();
            this.IncludeFile("nemo");
        }

        public void IncludePopup() {
            this.IncludePopup(false);
        }

        public void IncludePopup(bool withRefresh) {
            this.IncludeNemoController();
            this.IncludeFile("nemo.popup");
            if (withRefresh)
                this.IncludeFile("nemo.popup.refresh");
        }

        public void IncludeResizer() {
            this.IncludeNemoController();
            this.IncludeFile("nemo.resizer");
        }

        public void IncludeScroller() {
            this.IncludeNemoController();
            this.IncludeJQueryScrollPane();
            this.IncludeFile("nemo.scroller");
        }

        public void IncludeSorter() {
            this.IncludeNemoController();
            this.IncludeJQuerySort();
            this.IncludeJQueryCookie();
            this.IncludeFile("nemo.sorter");
        }

        public void IncludeTableFilter() {
            this.IncludeNemoController();
            this.IncludeFile("nemo.tablefilter");
        }

        /// <summary>
        /// Podaj nazwę pliku roszerzenia, bez js. Jeżeli biblioteka jest w wersji !DEBUG to zostanie załadowany plik {fileName}.min.js
        /// </summary>
        /// <param name="fileName"></param>
        public void IncludeFile(string fileName) {
            string loadSrc = fileName;
#if DEBUG
            loadSrc = fileName + ".js";
#else
            loadSrc = fileName + ".min.js";
#endif
            this.IncludeFileBasedOnJQuery("blackhouse.WebNemo.Web.Scripts." + loadSrc + ",blackhouse.WebNemo.Web");

        }

        #endregion

    }
}